function isFloat(num: number): boolean {
  return ~~num !== num
}

const random = {
  // [0,1)
  random(): number {
    return Math.random()
  },
  /**
   * 
   * @param minNum 
   * @param maxNum 
   * @returns 
   */
  randint(minNum: number, maxNum: number): number {
    if (isFloat(minNum) || isFloat(maxNum)) {
      throw new Error('minNum or maxNum is not float')
    }
    return ~~((Math.random() * maxNum) + minNum)
  },

  uniform(minNum: number, maxNum: number): number {
    return Math.random() * maxNum + minNum
  }
}
console.log(random.randint(1, 10));

export { random }